#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int search(int arr[], int n)
{
	int i = 0;
	int j = 0;
	int b = 0;
	for (i = 0; i < n; i++)
	{
		for (j = 0; j < n; j++)
		{
			if (arr[i] == arr[j])
				b++;
			else
				b--;
		}
		if (b > 0)
			return arr[i];
	}
}
int main()
{
	int arr[1000] = {0};
	int n = 0;
	int i = 0;
	scanf("%d", &n);
	for (i = 0; i < n; i++)
	{
		scanf("%d", &arr[i]);
	}
	printf("%d\n", search(arr, n));
	return 0;
}





